// this do-file reproduces regressions reported in Tables 4-6
 
version 14
use "data/reg_ilocos.dta" , clear


local controls  rural female  length_stay family_size age remittances_abroad benef_4P   bgy_pop


// check whether preferences are more concetrated in concentrated villages
local append replace
foreach x of varlist sd_bgy_*  { 

//	su `x'
//	replace `x' = (`x' - r(mean))/r(sd)
	
	su `x'
	local mean=r(mean)


	xtreg `x' herf_community   , fe cluster(group_mun) 
	outreg2 using "results/table_4_panel_a",  addstat("Mean Dep. Var." , `mean') 2aster  bdec(2) sdec(2)    nocons keep(herf_community)  `append'
	

	xtreg `x' herf_community  `controls'  , fe cluster(group_mun) 
	outreg2 using "results/table_4_panel_b", addstat("Mean Dep. Var." , `mean')  2aster bdec(2) sdec(2)    nocons keep(herf_community)   `append'

	local append append

}


local append replace
foreach x in bayanihan group { 

	su `x'
	local mean=r(mean)

	xtreg `x' herf_community   , fe cluster(group_mun) 
	outreg2 using "results/table_5",  addstat("Mean Dep. Var." , `mean') 2aster  bdec(2) sdec(2)    nocons keep(herf_community)  `append'
	
	local append append

	xtreg `x' herf_community  `controls' , fe cluster(group_mun) 
	outreg2 using "results/table_5",  addstat("Mean Dep. Var." , `mean') 2aster  bdec(2) sdec(2)    nocons keep(herf_community)  `append'


}



	local append replace
	foreach x in nb_nominees_2013 laakso_2013 golosov_2013  { 
		su `x'
		local mean=r(mean)
	
		xtreg `x' herf_community   , fe cluster(group_mun) 
		outreg2 using "results/table_6_panel_a", addstat("Mean Dep. Var." , `mean') 2aster  bdec(2) sdec(2)    nocons keep(herf_community)  `append'
	

		xtreg `x' herf_community   `controls'  , fe cluster(group_mun) 
		outreg2 using "results/table_6_panel_b", addstat("Mean Dep. Var." , `mean') 2aster  bdec(2) sdec(2)    nocons keep(herf_community   )   `append'

		local append append
	
	}
